// http://stackoverflow.com/questions/3653065/get-local-ip-address-in-node-js

// var os = require('os');
// var ifaces = os.networkInterfaces();
// for (var dev in ifaces) {
// 	var alias = 0;
// 	ifaces[dev].forEach(function(details) {
// 		if (details.family == 'IPv4') {
// 			console.log(dev + (alias ? ':' + alias : ''), details.address);
// 			++alias;
// 		}
// 	});
// }

var ifaces = require('os').networkInterfaces();
// console.log(ifaces);
var ips = {};
for (var dev in ifaces) {
	ifaces[dev].forEach(function(details) {
		// console.log(details);
		if (details.family === 'IPv4') {
			//console.log(dev, details.address);
			ips[dev] = details.address;
		}
	});
}
console.log(ips);

module.exports = ips;